<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.jframe.sys.utils.StringUtil" %>
<%
int id = StringUtil.parseInt(request.getParameter("id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/inc/editInc.jsp" />
<script type="text/javascript">
var action = 'tablemapAction';
$(function(){
	$.ajax({
		url: action+'.do?method=getObjById',
		type: 'post',
		data:{id:$('#id').val()},
		dataType:'json',
	    success: function(data){
	    	$('#data').form('load',data);
	    }
	});
	
	var saveForm = function(){
		var validate = $('#data').form('validate');
		if(validate){
		$.ajax({
			url:action+".do?method=save",
			data:{obj:$("#data").form2json()},
			dataType:'json',
			type:'post',
			success:function(data){
				if(data.result==true){
					$('#data').form('load',data.obj);
					alertInfo('保存成功！');
					parent.$('#grid').datagrid('reload');
				}
				else{
					alertError('保存失败！');
				}
			}
		});
		}else{
			return validate;
		}
	};
	$('#saveBtn').click(saveForm);
});
</script>
</head>
<body>
    <form id="data" method="post">
    	<input type="hidden" id="id" name="id" value="<%=id%>"/>
	    <table width="100%" class="tableForm">
	   		<tr align="center">
		    	<th colspan="4">
		    		<span >表映射管理</span>    	
			    </th>
		    </tr>
		    <tr>
		    	<td width="15%" align="right">
		    		代码：
		    	</td>
			    <td width="35%" align="left">
			    	<input type="text" id="enname" name="enname" required="true" style="width:150px;" class="easyui-validatebox"/>
			    </td>
			    <td width="15%" align="right">
		    		名称：
		    	</td>
				<td width="35%" align="left">
					<input type="text" id="cnname" name="cnname" required="true" style="width:150px;" class="easyui-validatebox"/>
				</td>
		    </tr>
			<tr>
				<td align="right">
		    		表名：
		    	</td>
				<td>
					<input type="text" id="tablename" name="tablename"  style="width:150px;" class="easyui-validatebox"/>
				</td>
				<td align="right">
		    		上级字段：
		    	</td>
				<td>
					<input type="text" id="upname" name="upname"   class="easyui-validatebox" style="width:150px;"/>										
				</td>
			</tr>
			<tr>
				<td align="right">
		    		查询条件：
		    	</td>
				<td colspan="3">
					<input type="text" id="conditions" name="conditions"  style="width:390px;" class="easyui-validatebox"/>
				</td>
			</tr>
			<tr>	
				<td align="right">
		    		键值字段：
		    	</td>
				<td>
					<input type="text" id="keyname" name="keyname"  style="width:150px;" class="easyui-validatebox"/>
				</td>					
				<td align="right">
		    		显示字段：
		    	</td>
				<td>
					<input type="text" id="valuename" name="valuename"  style="width:150px;" class="easyui-validatebox"/>
				</td>				
			</tr>
			<tr>	
				<td align="right">
		    		排序字段：
		    	</td>
				<td>
					<input type="text" id="seqname" name="seqname"  style="width:150px;" class="easyui-validatebox"/>
				</td>					
				<td align="right">
		    		排序方式：
		    	</td>
				<td>
					<input type="text" id="sorttype" name="sorttype"  style="width:150px;" class="easyui-validatebox"/>
				</td>						
			</tr> 
			<td align="right">
		    		类型：
		    	</td>
				<td>
					<select id="typeId" name="typeId"  valueField="id" textField="name" class="easyui-combobox" style="width:155px;" url="dataSourseAction.do?method=getRightTrees"></select>
				</td>
				<td></td><td></td>
			</tr>
			<tr align="center">
				<td colspan="4">
					<a id='saveBtn' class="easyui-linkbutton" plain="true" iconCls="icon-save">保存</a>
				</td>
			</tr>
		</table>
    </form>
</body>
</html>